home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / doc.lha / documentation / manual / kmp.notes.1to4 < prev    next >
Text File  |  1987-06-30  |  20KB  |  469 lines

  1. p1 "The symbol `===' ... means that for any x, the values and effects 
  2.     are the same as the values and effects of ..."
  3.  
  4.  Should some word like "defined" be modifying each of these "values 
  5.  and effects" phrases?
  6.  
  7. p4 "a core language --- syntax and semantics for expressions"
  8.  
  9.  At this point, you have not introduced the term expression. I think
  10.  it's important to early-on make some sort of note about expressions 
  11.  being objects and not external syntactic representations. I don't 
  12.  think having the note about external representation above this is
  13.  adequate. On the next page, you start to talk about forms and 
  14.  expressions as if people knew what they were. There may be a few 
  15.  who think expressions are parens and spaces and ... The ones who
  16.  are bright but have just been misled should have the opportunity to
  17.  get fixed somewhere in this part of the book. This is especially
  18.  important since all your examples will necessarily be presented as
  19.  external syntax.
  20.  
  21. p5 "Program execution typically occurs in an environment inferior to ..."
  22.  
  23.  You have not said that environments are hierarchical, so the wrong
  24.  interpretation of "inferior" may come out here (the one that makes you
  25.  think the system environment is somehow "more winning").
  26.  
  27. p5 Programs, Procedures, Functions
  28.  
  29.  Winston's book (latest draft) introduces the following terms (quoting):
  30.  
  31.       o A "procedure" is the basic entity in LISP that specifies 
  32.         how something is to be computed. A procedure may be defined 
  33.         by the user or provided by the LISP system.
  34.  
  35.       o A procedure (like +) supplied by LISP itself is called a "primitive".
  36.  
  37.       o A procedure that only computes a value based on its argument, is
  38.         called a "function". Procedures are not functions if they have
  39.         "side effects", such as assigning a value to a symbol other than 
  40.         one of the procedure's parameters.
  41.  
  42.       o A collection of procedures, intended to work together, is called
  43.         a "program".
  44.  
  45.       o An abstract description of a procedure or program, one not 
  46.         expressed in a programming language, is called an algorithm.
  47.         Such a description may, for example, be given in English or
  48.         as a block diagram. A procedure or a program may be considered
  49.         an implementation of  an algorithm in a particular programming
  50.         language.
  51.  
  52.  I dislike this definition of "primitive". I question some of the wording in
  53.  the description of "function" and "algorithm". But I think in general having
  54.  a nice, clearly defined, repertoire of terms like this would be nice if it
  55.  could be carried through.
  56.  
  57.  I also wish you would re-instate some of my terms like "universal" and
  58.  perhaps even the term "span" (as in "PLUS? spans only the real numbers.").
  59.  
  60.  Also, something Winston doesn't do but which I plan to suggest is to mark
  61.  clearly that these are not "the" definitions of the terms, but just the
  62.  local conventions for use in the context of this document. Somewhere, there
  63.  should be a clear diclaimer of the fact that other dialects use similar 
  64.  terms in incompatible and/or just-plain-muddy ways.
  65.  
  66. p7 Literals, examples
  67.  
  68.  I think I might put the equivalences in. It's amazing how many novices 
  69.  I've known who were surprised that
  70.  
  71.         (READ)''FOO => (QUOTE (QUOTE FOO))
  72.  
  73.  Hence, the second examples section might be written:
  74.  
  75.         (QUOTE A)     === 'A     => A
  76.         (QUOTE (A B)) === '(A B) => (A B)
  77.         ... etc
  78.  
  79.  
  80. p7 "Objects returned by literal expressions are read-only..."
  81.  
  82.  I already mentioned to you that I question if this even says what you
  83.  want but I'll note it here so it's all in one place.
  84.  
  85.  Also, I'm a little unsure of the term "read only" since you have not
  86.  defined it and since in some contexts in computer science it is synonymous
  87.  with "write protected". eg, Read-Only buffers in Emacs. You might want
  88.  to say "intended to be read-only".
  89.  
  90. p8 "If variables is not a proper list ... the variable x will be ..."
  91.  
  92.  Why do I want to say "the variable named x will be ..."? Do you think
  93.  that it matters? Something caught my eye about this wording which I am
  94.  not sure how to resolve: Is the object which is the symbol the variable 
  95.  or is it the name of the variable or does it denote the name or does
  96.  it co-denote the variable? Sigh.
  97.  
  98. p8 "If any <variable> is () instead of ..."
  99.  
  100.  I don't like this wording. Just about anything would be an improvement.
  101.  For example, I might prefer
  102.    "If any element of <variables> is ..."
  103.  or
  104.    "If in place of a variable, there is a () in the <variables> list, ..."
  105.  Anything that does not seem to imply "()" is a variable. I realize the 
  106.  name <variable> here is a formal term, but it still feels funny; especially
  107.  since () === NIL in other dialects and hence -is- a variable.
  108.  
  109.  Also, I think an example would help a lot.
  110.  
  111. p8 "Scoping: ..."
  112.  
  113.  An example would help. Perhaps:
  114.  
  115.         (LSET X 3)
  116.         (DEFINE (FOO Y) (+ X Y))
  117.         (DEFINE (G X) (+ X (FOO X)))
  118.         (G 4) => 11 ;not 12
  119.  
  120. p8 "Closure: ..."
  121.  
  122.  I would add an example here, too. Perhaps:
  123.  
  124.         (DEFINE (ADDER X) (LAMBDA (Y) (+ X Y)))
  125.         ((ADDER 5) 3) => 8
  126.         (DEFINE ADD5 (ADDER 5))
  127.         (DEFINE (TESTER X) (ADD5 (- X 5)))
  128.         (TESTER 7) => 7
  129.  
  130. p8 "There is no way (other than EQ?) ..."
  131.  
  132.  This is technically false. For example,
  133.  
  134.   (DEFINE (MY-EQ? X Y) ;Things that have EQ? built in
  135.     (WITHOUT-INTERRUPTS
  136.       (= (OBJECT-HASH X) (OBJECT-HASH Y))))
  137.  
  138.   or (DEFINE (MY-EQ? X Y) (MEMQ? X (LIST Y)))
  139.  
  140.   or (DEFINE (MY-EQ? X Y) (NOT (NEQ? X Y)))
  141.  
  142.   or even...
  143.  
  144.   (DEFINE MY-EQ? (L1 L2) ;GJS's paint-X-and-see-if-Y's-color-changes approach
  145.     (WITHOUT-INTERRUPTS
  146.       (COND ((NOT (EQUAL? (CAR L1) (CAR L2))) NIL)
  147.             (ELSE
  148.              (LET ((MARKER (IF (EQUAL? (CAR X) 'MARKER-1) 'MARKER-2
  149.                              'MARKER-1))
  150.                    (CAR-L1 (CAR L1)))
  151.                (UNWIND-PROTECT (PROGN (SET (CAR L1) MARKER)
  152.                                       (EQUAL? (CAR L1) MARKER))
  153.                  (SET (CAR L1) CAR-L1)))))))
  154.  
  155.  I guess my point is that if EQ? were the only way to tell the difference,
  156.  this wouldn't matter. But, in fact, EQ? is the only primitive which directly
  157.  does just that thing, but it is hardly the only way to tell. In fact, if
  158.  the only importance of object identity was that EQ? answered true, then
  159.  it would be worthless. A lot is implied by this fact. 
  160.  
  161.  I believe what you're trying to say here is OK; important, in fact.
  162.  I just don't think you are saying what you mean to say.
  163.  
  164. p9 "Uniqueness of symbols is defined..."
  165.  
  166.  The "(EQ? 'FOO 'FOO) => true" example is interesting but I am not sure
  167.  its implications will be seen to the untrained eye. Perhaps. Could I
  168.  con you into elaborating on the meaning of "uniqueness" and/or "interning"
  169.  (for symbols AND for more general data) either here or someplace else? It
  170.  is an interesting topic and worth of inclusion someplace.
  171.  
  172. p9 "There is one false value; this is a distinguished object called <null>."
  173.  
  174.  First of all, you call it <false> afterward, so it's a little funny that
  175.  you claim here its name is <null>.
  176.  
  177.  Second of all, I think it's not a good idea to give the false/null
  178.  confusion such good placement. IN FACT, I would (as with plists of 
  179.  symbols) just mark this relation as a bug in implementations and
  180.  write the manual as if it didn't have to be true. People will balk 
  181.  a little but as long as you don't actually change the implementation,
  182.  they'll probably let you get that far. Then, maybe later after the
  183.  manual has been made it crystal clear, one day things could magically
  184.  be righted ... or in the worst case, at least the language spec would
  185.  be pure even if the implementation was not...
  186.  
  187. p9 "A value intended to be used in this way is called a truth value."
  188.  
  189.  This sentence is ambiguous. My first reading took the reference to be
  190.  to the previous sentence ("Any other value is considered to be true."),
  191.  but I couldn't believe you meant "truth value" and "true value" to be
  192.  synonymous. If you mean for it to span both "true" and "false" values,
  193.  you must be more clear than just "in this way".
  194.  
  195. p9 "... usually involve a test expression ..."
  196.  
  197.  "test" would be another good glossary word. There should be a glossary
  198.  of useful terms. "test" denotes an expression, "predicate" a function.
  199.  I like this. LispM calls a test a "pred" in most of the relevant arglists.
  200.  This drives me batty. Standardizing terminology encourages better 
  201.  user-programming style for people who aren't handy with the thesaurus.
  202.  
  203. p9 "... equality predicate is a two-argument predicate which is
  204.     side-effectless and unaffected by side-effects, and ..."
  205.  
  206.  By this definition, EQUAL? is not an equality predicate.
  207.  
  208.  Further, the implication seems to be that predicates which are not
  209.  for equality (eg, PLUS?, PRIME?, ...) should be allowed to have 
  210.  side-effects?
  211.  
  212.  Are you sure you don't want the "is side-effectless" over predicates
  213.  in general? 
  214.  
  215.  Are you sure you don't want to rethink "not affected by side-effect"?
  216.  At the heart of this is that presumably you mean that for the same
  217.  arguments, equality predicates always return the same value even in
  218.  the face of side-effect; yet "sameness of argument" is something you
  219.  can't tell without presupposing you have the predicate you're trying
  220.  to define sometimes... Such is the case, at least, for EQUAL?
  221.  
  222. p10 "The system variable T ..."
  223.  
  224.  You might want a "(Programmers with prior LISP experience ...)" note
  225.  about how (EQ? T 'T) is not necessarily true. T and 'T are used 
  226.  interchangeably in some dialects. If you don't think it's worth the
  227.  space or bother, I won't insist.
  228.  
  229. p10 "Types"
  230.  
  231.  Objects don't have behaviors (except in the T sense of OBJECT, which
  232.  is not what I think you mean); functions have behaviors given object
  233.  arguments. There was some definition I've heard for types which said 
  234.  that it was sufficient to think of an object as being of a given type 
  235.  if for all functions defined upon that type, the behavior of those
  236.  functions was well-defined. Or something like that. More simply put,
  237.  that a type was just a way of describing a set of things upon which you
  238.  wanted to do a certain operation or set of operations. Anyway, these
  239.  are just ideas. My main point here is that I think the idea of 
  240.  "characteristic behaviors" is either too vague or too mathematical
  241.  or both or neither. I would prefer something slightly less cryptic.
  242.  
  243.  Interestingly, when you mention type predicates, you neglect to mention
  244.  that by convention they return true for things said to be of a certain
  245.  type and false otherwise. I imagine people will guess that, and in 
  246.  principle it might not matter, but it might be worth mentioning as a
  247.  point of formality.
  248.  
  249. p11 "Environments ... on entering LAMBDA-bodies"
  250.  
  251.  I would say "upon".
  252.  
  253. p11 "One such association ... is called a <binding>."
  254.  
  255.  I would say "Abstractly, one such association ..." or something to 
  256.  qualify that there is no first class object in the user world 
  257.  which corresponds to this pair. Alternate wording:
  258.   "Viewed abstractly, an environment is made up of a set of pairs.
  259.    Each pair, called a binding, represents an association between
  260.    a variable and a value in that environment. In general, environments
  261.    are created implicitly...etc."
  262.  
  263. p11 "Each contour augments an ``outer'' ..."
  264.  
  265.  Parallel construction; since you haven't said "Each inner contour",
  266.  it seems funny.
  267.  
  268.  Also, "a few" is pretty funny since it might mean zero.
  269.  
  270.  Perhaps:
  271.   "A new contour is always created ``inside of'' some existing contour.
  272.    A new contour augments its ``parent'' or ``outer'' contour by
  273.    providing bindings for any new identifiers..."
  274.  
  275. p11 "The values of BLOCK and LAMBDA ... they are reserved words..."
  276.  
  277.  Will have to change now that you've backed down about reservedness.
  278.  
  279. p11 "... in an outermost environment in which the variable LIST is bound." 
  280.  
  281.  Outermost? I would prefer "outer", which means rewording. eg,
  282.  
  283.   "The variable LIST is presumably bound in some outer environment."
  284.  
  285.  You might add "(such as the initial environment)" or "...standard..."
  286.  if you think the "outer environment" needs qualification of some sort.
  287.  
  288. p11 "There are two kinds of contours, <lambda-contours> and <locales>..."
  289.  
  290.  I would ammend parts of this paragraph such that you say something like:
  291.    "Lambda contours, such as those explained above, are introduced by ..."
  292.  and
  293.    "Locales, to be explained later, are introduced by ..."
  294.  to avoid any possible feeling that this page is sufficient to understand
  295.  the two kinds.
  296.  
  297. p11 "...where the variables are bound to those values..."
  298.  
  299.  "...where each of the variables is bound to its {associated/respective}
  300.      value..."
  301.  
  302. p12 LET*
  303.  
  304.  This introduces the concept of "sequential binding" without introducing
  305.  it as a technical term. Put this and "parallel binding" on my glossary
  306.  wish-list. I have run into people from time to time who object to the 
  307.  terms "parallel" and "sequential" since in fact all binding is sequential
  308.  in certain ways and certainly on a single-processor machine, parallel
  309.  anything is a bit difficult to grasp. I like the terms "sequential" and
  310.  "parallel" here, but I think it important to at least qualify them.
  311.  
  312. p12 "LABELS is useful for defining procedures that may be"
  313.  
  314.  I would say "... which may be ..."
  315.  
  316. p12 "... where all of the variables are bound to those values ..."
  317.  
  318.  "... where each of the variables is bound to its respective value ..."
  319.  
  320. p13 "... However, the values of the variables are not defined until body ..."
  321.  
  322.  Something like:
  323.  "Although the evaluation of the <values> takes place in an environment
  324.   where all of the <variables> are bound, the actual values of the
  325.   <variables> do not become well-defined until the body is entered.
  326.   Hence, the <value> forms may close over any of the <variables> for 
  327.   later use, but may not directly access the contents of any of the
  328.   <variables>."
  329.  Reason:
  330.   It is worth adding a little redundancy about the difference between
  331.   saying a binding is in effect and saying a variable has a well-defined
  332.   value. Also, I think the statement about not "using" <variables> is too
  333.   nebulous.
  334.  Note: If you use a description such as the one I suggest, the phrase
  335.   "closed over" should be entered in the glossary.
  336.  
  337. p13 "==="
  338.                       ~
  339.  Have you considered "=" (two bars with tilde above) to denote a weaker
  340.  kind of slightly assymetric equivalence meaning "can be implemented by"?
  341.  
  342. p14 "Locales serve two purposes..."
  343.  
  344.  I don't think this opening paragraph is sufficiently motivational.
  345.  It doesn't give you a good reason for wanting to read the section other
  346.  than just that it mystifies you and that you therefore have no choice.
  347.  
  348.  I would rather it be something along the lines of:
  349.  
  350.    "A locale is a mutable binding contour which serves as a bounding
  351.     point for `free' references."
  352.  
  353.  I also like the phrase "locally global contour" if you can work it in.
  354.  Making analogy to a filesystem "working directory" might be handy, too.
  355.  
  356.  In any case, the main thing is that the first paragraph in a section like
  357.  this should be more abstract than technical. The first paragraph as it
  358.  is written here contains important and useful info, but it should not come
  359.  first.
  360.  
  361.  If paragraph 2 were reworked and moved above paragraph 1, I would be
  362.  satisfied on this point.
  363.  
  364. p14 "Introduces a locale..."
  365.  
  366.  I think of the verb "introduce" as meaning a declarative form that
  367.  precedes the thing it introduces. Eg, (DECLARE ...) at the top of a
  368.  lambda contour or the FOR statement in basic. Since LOCALE goes around
  369.  the contour it introduces, I feel funny about saying it "introduces".
  370.  Can you think of another verb? Would "establishes" or "creates" or
  371.  "instantiates" work?
  372.  
  373. p14 "Introduces a locale ... If <variable> is () ..."
  374.  
  375.  I again take issue with saying () can be a variable, which is what this
  376.  reads like. I would call the cadr of a LOCALE form <spec> and say
  377.  it may be either a variable or ().
  378.  
  379.  By the way, it's an incompatible change (which could be made upward
  380.  compatibly in one release and then cleaned up in a later release), but
  381.  I wonder if it shouldn't be (LOCALE (var) ...) or (LOCALE () ...) just
  382.  to alleviate this wording problem and also to motivate the () better. 
  383.  After all, I always wonder why it's not just any non-symbol that works.
  384.  Have I complained about this before? I seem to remember I might have...
  385.  
  386. p14 "(DEFINE variable value) -> undefined"
  387.  
  388.  I find it amusing that DEFINE yields an undefined value. At first glance,
  389.  this should seem counterintuitive.
  390.  
  391. p14 "The variable is given <value> as its value.
  392.      The second DEFINE syntax is for defining procedures."
  393.  
  394.  I dunno, but I have the subtle impression this biases people just 
  395.  slightly toward thinking you have to use the second syntax for
  396.  procedures (even though the next example ought to fix that). People
  397.  frequently skim and miss that sort of thing. I would make it more
  398.  apparent as in:
  399.  
  400.   "In the simple syntax, the variable is simply given <value> as its value.
  401.  
  402.    The second syntax just provides ``syntactic sugar'' for the
  403.    common case of defining a variable to hold a function.
  404.    Using the second syntax,
  405.         (DEFINE <variable> (LAMBDA <arguments> . <body>))
  406.    may written as simply:
  407.         (DEFINE (<variable> . <arguments>) . <body>)"
  408.    
  409. p14 "LSET is identical to DEFINE except that the procedure definition
  410.      is not permitted, and the variable is declared ..."
  411.  
  412.  This makes it sound like it fell naturally out of the code, but you are
  413.  being nasty and forcing the user to write the long syntax. (Of course, the
  414.  thing I'm going to propose as an alternative will sound like you were
  415.  just too lazy to write the code so he could write the short syntax. The
  416.  real idea that should come through in some subtle way is that the 
  417.  second DEFINE syntax is superfluous since you rarely need it anyway.)
  418.  I would say:
  419.  
  420.         "LSET is identical to the simple case of DEFINE, except that the
  421.          variable is declared to be alterable."
  422.  
  423.  or at least just
  424.  
  425.         "LSET is identical to DEFINE except that the variable is
  426.          declared to be alterable."
  427.  
  428.  
  429. p14 "Any LOCALE-expression ..."
  430.  
  431.  Do you really use the syntax "FOO-expression" a lot? I haven't noticed
  432.  it until just now. I don't like the hyphen. Also, I prefer the word "form"
  433.  rather than "expression", especially  when the car does not denote a subr.
  434.  
  435.  In any case, I might revamp the last sentence as follows:
  436.  
  437.    "Cases may arise where LABELS or LET could be rewritten using LOCALE
  438.     (or vice versa). It may vary with the context whether a given choice
  439.     makes code easier or harder to read or manipulate."
  440.  
  441. p15 "... *DEFINE or *LSET ..."
  442.  
  443.  This should make some sort of (possibly casual and fleeting) reference
  444.  to the fact that such calls may be either explicit or implicit. I wouldn't
  445.  dwell on it, but I think it might not hurt to at least mention.
  446.  eg, I presume you can instantiate a locale as your working environment,
  447.  in which case you wouldn't write *DEFINE explicitly.
  448.  Also, I presume IMPORT calls these guys implicitly.
  449.  
  450. p15 "References in a LOCALE body to variables bound later on ..."
  451.  
  452.  You should be clearer about this. Obviously, 
  453.   (LOCALE () (DEFINE (FOO) (BAR)) (DEFINE (BAR) ...)) 
  454.  works (doesn't it?).
  455.  
  456.  Should some of this warning be in the form of a "bug" note rather 
  457.  than a language spec issue?
  458.  
  459. p16 *LSET
  460.  
  461.  I dunno about "creates a binding". I know the meaning of "binding" you
  462.  mean here, but I would check through the manual to make sure this term
  463.  is consistently used. It's a good glossary term anyway, but you might want
  464.  to point out it has more than one usage. I suppose this will be easier when
  465.  BIND has been renamed. I might say something like:
  466.   "Creates an association between <identifier> and <value> in the given
  467.    <locale>, such that a later *VALUE access to the given <identifier>
  468.    in that <locale> will yield <value>."
  469.